home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
001-025
/
disk_013
/
patch.abc
< prev
next >
Wrap
Text File
|
1992-05-06
|
2KB
|
54 lines
100 ' ----------------------------- Patcher ---------------------------
110 '
120 ' by George Musser Jr.
130 ' 5 January 1986
140 '
150 ' This little routine places a specified patch at the desired place
160 ' in a file, generating a file with the extension ".Patched".
170 '
180 ' Name of file to patch
190 fil$="ram:CLI"
200 ' Desired patch
210 patch$="CON:0/9/530/191/New CLI Window"
220 ' Location of patch, found by using TYPE OPT H
230 loc%=&h264
240 ' Open files
250 open "i",1,fil$
260 open "o",2,fil$+".Patched"
270 ' Loop through file
280 patched%=0
290 ptr%=1
300 while not eof(1)
310 ' Fill buffer
320 line input #1,buf$
330 ' Replace lost linefeed
340 ' N.B. Watch out if last character in file is line feed
350 if len(buf$)<255 and not eof(1) then buf$=buf$+chr$(10)
360 ' If already patched, then finish off file
370 if patched% goto 570
380 ' New position in file
390 ptr%=ptr%+len(buf$)
400 ' If not yet at patch site, dump buffer and try again
410 if ptr%<loc% goto 570
420 ' Output bytes before desired location
430 print #2,using "&";left$(buf$,len(buf$)-ptr%+loc%+1);
440 ' Output patch
450 print #2,using "&";patch$;
460 ' Make sure buffer is full
470 buf$=mid$(buf$,len(buf$)-ptr%+loc%+2)
480 while not eof(1) and len(buf$)<255
490 get #1,ch$
500 buf$=buf$+ch$
510 wend
520 ' Print remainder of buffer
530 buf$=mid$(buf$,len(patch$)+1)
540 ' Done with patching
550 patched%=-1
560 ' Put buffer in output file
570 print #2,using "&";buf$;
580 wend
590 ' Bye, bye
600 close
610 end